<template>
  <div class="srbd">
    <div class="bd">
      <div class="cesaun_container">
        <h3 class="title">
          <p class="line">星座配对</p>
        </h3>
        <div>
          <div>
            <el-form :model="form" ref="form" label-width="120px">
              <!-- 姓名 -->
              <el-form-item label="男方星座" prop="name">
                <el-select
                  v-model="form.xingzuo_male"
                  clearable
                  style="width: 450px"
                >
                  <el-option
                    v-for="item in xingzuo"
                    :key="item.value"
                    :label="item.name"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>

              <el-form-item label="女方星座" prop="name">
                <el-select
                  v-model="form.xingzuo_female"
                  clearable
                  style="width: 450px"
                >
                  <el-option
                    v-for="item in xingzuo1"
                    :key="item.value"
                    :label="item.name"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="语言：" prop="lang">
                <el-radio-group v-model="form.lang">
                  <el-radio label="zh-cn">中文</el-radio>
                  <el-radio label="en-us">英文</el-radio>
                  <el-radio label="zh-tw">繁体</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-form>
          </div>
        </div>
        <div style="text-align: center">
          <el-button type="primary" @click="submitForm" style="margin: 20px"
            >立即测算</el-button
          >
        </div>

        <!-- 主体表单 -->
      </div>
      <div>
        <h3 class="title">
          <p class="line">测算简介</p>
        </h3>
        <div style="font-size: 14px; margin: 0 10px 20px 10px">
          <p style="">
            1.星座配对测试姻缘源自西方算命，融合现代的性格学、人际关系学衍生而成，据说是一种准确率很高的情侣爱情配对测试方法。
          </p>

          <p>3.心诚则灵，测算结果仅供参考。</p>
        </div>
      </div>
    </div>
    <el-dialog
      title="测算结果"
      :visible.sync="centerDialogVisible"
      width="50%"
      class="dialog_cesuan"
    >
      <div class="bazi_info" v-if="result != null">
        <div class="base_info">
          <div class="show">
            <span class="l">男方星座:</span>
            <span class="r">{{ result.xingzuo_male }}</span>
          </div>
          <div class="show">
            <span class="l">女方星座:</span>
            <span class="r">{{ result.xingzuo_female }}</span>
          </div>
          <div class="show">
            <span class="l">配对比重:</span>
            <span class="r">{{ result.description["配对比重"] }}</span>
          </div>
          <div class="show">
            <span class="l">两情相悦指数:</span>
            <span class="r">{{ result.description["两情相悦指数"] }}</span>
          </div>

          <div class="show">
            <span class="l">天长地久指数:</span>
            <span class="r">{{ result.description["天长地久指数"] }}</span>
          </div>
          <div class="show">
            <span class="l">配对指数:</span>
            <span class="r">{{ result.description["配对指数"] }}</span>
          </div>

          <div class="show">
            <span class="l">工作分数:</span>
            <span class="r">{{ result.description["工作分数"] }}</span>
          </div>
          <div class="show">
            <span class="l">工作配对:</span>
            <span class="r">{{ result.description["工作配对"] }}</span>
          </div>

          <div class="show">
            <span class="l">爱情分数:</span>
            <span class="r">{{ result.description["爱情分数"] }}</span>
          </div>

          <div class="show">
            <span class="l">爱情配对:</span>
            <span class="r">{{ result.description["爱情配对"] }}</span>
          </div>

          <div class="show">
            <span class="l">金钱分数:</span>
            <span class="r">{{ result.description["金钱分数"] }}</span>
          </div>
          <div class="show">
            <span class="l">金钱配对:</span>
            <span class="r">{{ result.description["金钱配对"] }}</span>
          </div>
          <div class="show">
            <span class="l">健康分数:</span>
            <span class="r">{{ result.description["健康分数"] }}</span>
          </div>
          <div class="show">
            <span class="l">健康配对:</span>
            <span class="r">{{ result.description["健康配对"] }}</span>
          </div>
          <div class="show">
            <span class="l">恋爱建议:</span>
            <span class="r">{{ result.description["恋爱建议"] }}</span>
          </div>

          <div class="show">
            <span class="l">注意事项:</span>
            <span class="r">{{ result.description["注意事项"] }}</span>
          </div>
        </div>

        <div class="yl">
          <span>仅供娱乐！请勿当真</span>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  computed: {
    currentPath() {
      return this.$route.path; // 获取当前路由路径
    },
  },
  data() {
    return {
      centerDialogVisible: false,
      birthday: "",
      xingzuo: [
        { name: "水瓶座", value: "水瓶男" },
        { name: "双鱼座", value: "双鱼男" },
        { name: "白羊座", value: "白羊男" },
        { name: "金牛座", value: "金牛男" },
        { name: "双子座", value: "双子男" },
        { name: "巨蟹座", value: "巨蟹男" },
        { name: "狮子座", value: "狮子男" },
        { name: "处女座", value: "处女男" },
        { name: "天秤座", value: "天秤男" },
        { name: "天蝎座", value: "天蝎男" },
        { name: "射手座", value: "射手男" },
        { name: "摩羯座", value: "摩羯男" },
      ],

      xingzuo1: [
        { name: "水瓶座", value: "水瓶女" },
        { name: "双鱼座", value: "双鱼女" },
        { name: "白羊座", value: "白羊女" },
        { name: "金牛座", value: "金牛女" },
        { name: "双子座", value: "双子女" },
        { name: "巨蟹座", value: "巨蟹女" },
        { name: "狮子座", value: "狮子女" },
        { name: "处女座", value: "处女女" },
        { name: "天秤座", value: "天秤女" },
        { name: "天蝎座", value: "天蝎女" },
        { name: "射手座", value: "射手女" },
        { name: "摩羯座", value: "摩羯女" },
      ],
      result: {
        description: {
          配对指数: "80",
          配对比重: "50:50",
          两情相悦指数: "4",
          天长地久指数: "4",
          结果评述: "相处和谐的一对",
          恋爱建议:
            "两个白羊座的人在一起是相当理想的一对，他们能彼此理解对方的想法，能以轻松愉悦的心情去交往。他们在感情上容易产生共鸣，但若过分干涉，就会有分歧！羊儿是属于热情、开放、直接的人，两个人一旦来电就会迅速好上，因此他们也是众星座中最热情一对情侣。",
          注意事项:
            "羊儿个性要强，是天生的领导者，所以他俩会常常因争权而起争执，动不动就杠上出现火爆情形。他们虽然争执多，但也不是没有相敬如宾的时候，只要正确处理双方关系，感情根基厚实，相信你们的争执也就像龙卷风过境一样，来得快去得也快！",
          工作配对:
            "白羊男和白羊女在工作上可能会有很强的竞争意识，他们都充满了热情和活力，喜欢追求挑战和目标。他们可能会相互激励，在工作中相互支持，共同努力追求共同的目标。然而，由于双方都有着强烈的个人主义和领导欲望，有时可能会发生意见分歧或冲突。因此，他们需要学会合作和妥协，才能更好地发挥彼此的优势，实现共同的职业目标。",
          工作分数: "85",
          爱情配对:
            "白羊男和白羊女在爱情中可能会有很高的契合度，因为他们都充满了激情和冲动，能够共同享受生活中的刺激和乐趣。他们彼此之间的火花可能会非常强烈，充满了浓烈的爱意和...",
          爱情分数: "90",
          金钱配对:
            "白羊男和白羊女在金钱管理方面可能会有一些挑战，因为他们都倾向于冲动消费和追求享受。他们可能会花费大量的金钱在各种刺激和娱乐活动上，而忽视了长期的理财规划和储...",
          金钱分数: "70",
          健康配对:
            "白羊男和白羊女在健康方面可能都非常注重身体健康，他们充满了活力和精力，喜欢积极参与各种运动和健身活动。他们可能会共同享受户外活动，如跑步、徒步、健身等，保持...",
          健康分数: "95",
        },
        xingzuo_male: "白羊男",
        xingzuo_female: "白羊女",
      },
      area: "",
      form: {
        xingzuo_female: "",
        xingzuo_male: "",
        lang: "zh-cn",
      },
    };
  },
  mounted() {},
  methods: {
    submitForm() {
      if (this.form.xingzuo_male == "") {
        this.$message({
          message: "请输入男方星座",
          type: "warning",
        });
        return;
      }
      if (this.form.xingzuo_female == "") {
        this.$message({
          message: "请输入女方星座",
          type: "warning",
        });
        return;
      }

      this.form["api_key"] = "FNcQHQuf0W8wDrXMjWc0xqTzw";
      let config = {
        headers: {
          "Content-Type": "application/x-www-form-urlencoded",
        },
      };
      this.$axios
        .post(window.config.apiUrl + "/v1/Peidui/xingzuo", this.form, config)
        .then((res) => {
          if (res.data.errcode == -1) {
            this.$message({
              type: "warning",
              message: res.data.errmsg,
            });

            return;
          }

          this.centerDialogVisible = true;
          this.result = res.data.data;
          console.log(this.result);
        });
    },
  },
};
</script>

<style scoped lang="scss">
.bd {
  border: 1px solid #e5e5e5;
}

.cesaun_container {
}

::v-deep .el-card.is-always-shadow {
  box-shadow: none !important;
}

::v-deep .el-card__header {
  padding: 10px 20px !important;
}

.form-card {
  width: 100%;
  margin: 0 auto;
  border-radius: 2px;
}

.form-title {
  margin: 0;
  color: #303133;
  font-size: 16px;
  text-align: left;
}

.el-form-item {
  margin-bottom: 22px;
}

.el-radio {
  margin-right: 30px;
}

::v-deep .distpicker-address-wrapper {
  width: 100% !important;
}

@mixin flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  height: 45px;
}

@mixin tr1_w {
  width: 33px;
  text-align: center;
}

.dialog_cesuan {
  text {
    user-select: all;
  }

  .bazi_info {
    .base_info {
      margin: 20px;

      .title {
        display: flex;
        padding: 5px;

        .shu {
          width: 5px;
          height: 20px;
          background-color: #e6a84b;
          border-radius: 10px;
        }

        .ti {
          padding-left: 8px;
          font-weight: 800;
          font-size: 15px;
        }
      }

      .show {
        margin-top: 15px;

        .l_ {
          font-size: 14px;
          display: inline-block;
          min-width: 50px;
          font-weight: 800;
        }

        .l {
          font-size: 15px;
          display: inline-block;
          min-width: 80px;
          font-weight: 800;
        }
      }

      .details {
        border: 1px solid #e5e5e5;
        border-bottom: none;
        margin-top: 20px;

        .names {
          text-align: center;
          color: #e6a84b;
          border-bottom: 1px solid #e5e5e5;
          color: #e6a84b;
          font-weight: 800;
          background-color: #fff3ef;
          height: 50px;
          line-height: 50px;
        }

        .des {
          border-bottom: 1px solid #e5e5e5;
          padding-left: 10px;
          display: flex;
          align-items: center;

          .des_text {
            color: #e6a84b;
            width: 14%;
            font-weight: 800;
            user-select: text;
          }

          .des_deta {
            width: 85%;
            line-height: 26px;
            text-indent: 2em;
            user-select: text;
          }
        }
      }
    }
  }
}
</style>